﻿//name:worker_B.h
//who:by Jack Chen
//what:pseudo code for npc, worker_B.cpp

#include <worker_B.h>

void worker_B::trigger__player_input()
{
	string qestion;
	std::cin >> qestion;
	this->process p; // C++正確的寫法有待商確... 意思表達到就好
	                 // decpare an "enum" object p where its definition comes from the class
	if(question == "ask xxx about boat")
	{
		switch(process)
		{
			case 0:
				write("你需要一艘可以到達乞巧村的船阿,那可是需要特殊的船隻,要又小又輕. 給我xx綑紙莎草莖, 才能幫你做一艘紙莎小船."); //玩家第一次問問題的敘述(ask worker about boat)
				p = process_needBoat;
				break;
			case 1:
				write("請在給我xx數量的紙莎草莖.");  
				p = process_needPaperRod;    // your original code dones't have this line so I'm also not sure if you need it; currently just put it here
				break;
			case 2:
				write("我正在忙著造船晚點再過來吧");
				p = process_busy;            // your original code dones't have this line so I'm also not sure if you need it; currently just put it here
				break;
			case 3:
				write("來吧 船造好了 請小心使用");
				//here should be a coommand for giving boat to player 
				p = process_doneJobDone;     // your original code dones't have this line so I'm also not sure if you need it; currently just put it here
			case 4:
				write("我造的船還不錯用吧~");
				p = process_doneBuddha;
				break;
		}
	}
	
	if(question == "take boat")
	{
		switch(process)
		{
			case 2:
				write("正在忙著造船晚點再過來吧");
				break;
			case 3:
				write("來吧 船造好了 請小心使用");
				break;
		}
	}
	
	if(question == "give xx to xxx")
	{
		this->counting(xx); // xx means amount of raw
	}
		
				
			
}

void worker_B::counting(int given)     //to deal with when player give something to NPC
{
	required += given;
	if(required >= 100)
	{
		write("ok了,等我30分鐘吧");
		timer();
		process = 2;
	}
	if(required < 100)
	{
		write("還差" << required << "份的xxx");
	}
}

void worker_B:timer()
{
	Sleep(30min);
	process = 3;
}














				
		
	